{{include file="../Common/header"}}
	<!--/header-->
	<div id="row">
		<!--left-->
		{{include file="../Common/presonal_left"}}
		<!--/left-->
		<!--right-->
		<div id="presonal-right">
			<h3 class="order-title">我的收货地址</h3>
			<div class="address-box">
				{{if value="$addressData"}}
				{{foreach from="$addressData" value="$a"}}
				<div class="address-con">
					<dt>姓名：{{$a['name']}}</dt>
					<dd>
						<p>电话：{{$a['phone']}}</p>
						<p>地址：{{$a['address']}}</p>
						<p>邮编：{{$a['postcode']}}</p>
					</dd>
					<p class="address-btn">
						<a uaid="{{$a['uaid']}}" class="address-edit">编辑</a>
						<a href="javascript:if(confirm('确定删除吗？')) location.href='{{U('del',array('uaid'=>$a['uaid']))}}';" class="address-del">删除</a>
					</p>
				</div>
				{{endforeach}}
				{{endif}}
				<div class="address-add">添加新地址</div>
			</div>
		</div>
		<script type="text/javascript">
		$(function(){	
			//初始化方法
			area.init('a');
			//添加新地址
			$('.address-add').click(function(){
				$('#overlay').css({display:'block'});
				$('.add-address').css({display:'block'});
			});
			//关闭、取消
			$('.address-header .address-hidden').click(function(){
				$('#overlay').css({display:'none'});
				$('.address').css({display:'none'});
			});
			$('.address-button span').click(function(){
				$('#overlay').css({display:'none'});
				$('.address').css({display:'none'});
			});
			//编辑收货地址
			$('.address-edit').click(function(){
				$('#overlay').css({display:'block'});
				$('.edit-address').css({display:'block'});
				var uaid=$(this).attr('uaid');
				$.ajax({
					type:"post",
					url:"{{U('Presonal/editAddress')}}",
					data:{uaid:uaid},
					dataType:'json',
					success:function(phpData){
						$('.edit-address .address-name').attr('value',phpData.name);
						$('.edit-address .address-phone').attr('value',phpData.phone);
						$('.edit-address .address-name').attr('value',phpData.name);
						$('.edit-address .xx').attr('value',phpData.xx);
						$('.edit-address .postcode').attr('value',phpData.postcode);
						$('.edit-address .uaid').attr('value',phpData.uaid);
						//初始化方法
						area.init('b');
						//修改的时候默认被选中效果
						 area.selected(phpData.sheng,phpData.shi,phpData.xian);
					}
				});
			
			});
			
		})
		</script>
		<div id="overlay"></div>
		<!--添加-->
		<div class="address add-address">
			<form action="{{U('Presonal/address')}}" method="post">
				<div class="address-header">
					<span>添加收货地址</span>
					<span class="address-hidden">X</span>
				</div>
				<span style="color:red;padding-left:25px;font-size:12px;">注：*标注的为必填项</span>
				<div class="address-tab">
					<p><span class="color">*</span><span>收货人姓名：</span><input type="text" name="name" value=""/></p>
					<p><span class="color">*</span><span>收货人地址：</span>
						<select name="address[]" id="a1">
							
						</select>
						<select name="address[]" id="a2">
							
						</select>
						<select name="address[]" id="a3">
							
						</select>
						<input type="text" name="address[]" value=""/> 
					</p>
					<p><span class="color">*</span><span>手机号码：</span><input type="text" name="phone" value=""/> </p>
					<p><span class="e-span">邮编：</span><input type="text" name="postcode" value=""/></p>
					<input type="hidden" name="shop_user_uid"  value="{{$_SESSION['nickuser']['uid']}}" />
				</div>
				<div class="address-button">
					<input type="submit" value="提交"/><span>取消</span>
				</div>
			</form>
		</div>
		<!--编辑-->
		<div class="address edit-address">
			<form action="{{U('Presonal/edit')}}" method="post">
				<div class="address-header">
					<span>编辑收货地址</span>
					<span class="address-hidden">X</span>
				</div>
				<span style="color:red;padding-left:25px;font-size:12px;">注：*标注的为必填项</span>
				<div class="address-tab">
					<p><span class="color">*</span><span>收货人姓名：</span><input type="text" name="name" class="address-name" value=""/></p>
					<p><span class="color">*</span><span>收货人地址：</span>
						<select name="address[]" id="b1">
							
						</select>
						<select name="address[]" id="b2">
							
						</select>
						<select name="address[]" id="b3">
							
						</select>
						<input type="text" name="address[]" class="xx" value=""/> 
					</p>
					<p><span class="color">*</span><span>手机号码：</span><input type="text" name="phone" class="address-phone" value=""/> </p>
					<p><span class="e-span">邮编：</span><input type="text" name="postcode" class="postcode" value=""/></p>
					<input type="hidden" name="uaid" class="uaid" value="" />
				</div>
				<div class="address-button">
					<input type="submit" value="提交"/><span>取消</span>
				</div>
			</form>
		</div>
		<!--/right-->
	</div>
	<!--footer-->
	{{include file="../Common/footer"}}
	<!--/footer-->
	</body>
</html>
